package com.bruce.pattern.behavioral.visitor.demo1;

/**
 * Created by bruce on 2018/11/11 19:38
 */
public class Computer implements ComputerPart {

    private ComputerPart[] parts;

    public Computer() {
        parts = new ComputerPart[]{new Mouse(), new Keyboard(), new Monitor()};
    }

    @Override
    public void accept(ComputerPartVisitor computerPartVisitor) {
        for (ComputerPart part : parts) {
            part.accept(computerPartVisitor);
        }
        computerPartVisitor.visit(this);
    }

    @Override
    public String getName() {
        return "dell电脑";
    }
}
